home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / opengl / xlib / skeeter.h < prev    next >
Encoding:
Text File  |  1994-08-02  |  4.8 KB  |  173 lines

  1. /*
  2.  * Copyright 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17.  
  18. /*
  19.  * skeeter.h
  20.  *     skeeter header file
  21.  */
  22.  
  23. int IsHit = 0;
  24. int IsHitX, IsHitY;
  25. int leftHit, rightHit;
  26.  
  27. #define MAX_SHOTS 100
  28. int shotsFired = 0;   /* number of shots fired; shotgun, 2 per pull */
  29.  
  30. #define ZDEPTH 100.0
  31.  
  32. /*
  33.  * light properties
  34.  */
  35. static float ambient[] = { 0.2, 0.2, 0.2, 1.0 };
  36. static float diffuse[] = { 0.4, 0.4, 0.4, 1.0 };
  37. static float specular[] = { 1.0, 1.0, 1.0, 1.0 };
  38. static float lpos[] = { 0, 0, 10, 0 };
  39.  
  40. static float l2_ambient[] = { 0.3, 0.2, 0.2, 1.0 };
  41. static float l2_diffuse[] = { 0.6, 0.4, 0.4, 1.0 };
  42. static float l2_specular[] = { 1.0, 0.5, 0.5, 1.0 };
  43. static float l2_lpos[] = { -1, -3, 10, 0 };
  44. static float l2_direction[] = { 1, 1, 0, 0 };
  45.  
  46. static float l3_ambient[] = { 0.0, 0.0, 0.3, 1.0 };
  47. static float l3_diffuse[] = { 0.0, 0.0, 0.6, 1.0 };
  48. static float l3_specular[] = { 0.0, 0.0, 1.0, 1.0 };
  49. static float l3_lpos[] = { -1, 3, 10, 0 };
  50. static float l3_direction[] = { -1, -1, 0, 0 };
  51.  
  52. /*
  53.  * light model ambient properties
  54.  */
  55. float alm[] = { 0.1, 0.1, 0.1, 1};
  56.  
  57. /*
  58.  * material properties for left skeet
  59.  */
  60. static float gambient[] = { 0.2, 0.3, 0.0, 1.0 };
  61. static float gdiffuse[] = { 0.22, 0.55, 0.0, 1.0 };
  62. static float gspecular[] = { 1.00, 1.00, 0.00, 1.0 };
  63. float shininess[] = { 8.0 };
  64.  
  65. /*
  66.  * material properties for left skeet
  67.  */
  68. static float bambient[] = { 0.2, 0.0, 0.3, 1.0 };
  69. static float bdiffuse[] = { 0.22, 0.0, 0.55, 1.0 };
  70. static float bspecular[] = { 1.00, 1.00, 0.00, 1.0 };
  71.  
  72.  
  73.  
  74. static float mambient[] = { 0.2, 0.2, 0.2, 1.0 };
  75. static float mdiffuse[] = { 0.4, 0.4, 0.4, 1.0 };
  76. static float mspecular[] = { 1.00, 1.00, 1.00, 1.0 };
  77.  
  78. static float ma2[] = { 0.3, 0.3, 0.3, 0.1 };
  79. static float md2[] = { 0.6, 0.6, 0.6, 0.1 };
  80. static float ms2[] = { 1.00, 1.00, 1.00, 0.1 };
  81.  
  82.  
  83. /*
  84.  * some common X pixel color values
  85.  */
  86. int WHITE_PIXEL_NUM;
  87. int RED_PIXEL_NUM;
  88. int BLACK_PIXEL_NUM;
  89.  
  90. /*
  91.  * default window size
  92.  */
  93. #define WINSIZE 600
  94.  
  95.  
  96. /*
  97.  * overlay/underlay flags
  98.  */
  99. int USE_OVERLAY = False;
  100. int USE_UNDERLAY = False;
  101.  
  102. int  xloc, yloc;
  103. /*
  104.  * X stuff...
  105.  */
  106. int  xorigin, yorigin;        /* window origin */
  107. unsigned int  width, height;    /* window width & height */
  108. Display *dpy;                   /* X Display */
  109. Window win;                     /* X Window Id */
  110. Window owin;                    /* X overlay window id */
  111. Window uwin;                    /* X underlay window id */
  112. GLXContext cx;                  /* Extesion to X server; GLX context
  113.                                      Data structure for X to hold GL global
  114.                                      data, so that we don't have to send them
  115.                                      to X through protocal everytime to
  116.                                      eliminate X traffic */
  117.  
  118. Window winList[3];              /* list of X windows */
  119.  
  120. GLXContext ocx;                 /* overlay window context */
  121. GLXContext ucx;                 /* underlay window context */
  122.  
  123. /*
  124.  * clay pidgeons
  125.  */
  126. #define CD1_LIST        1       /* cd #1 display list id */
  127. #define SKEETER_LIST    2       /* skeeter bug display list */
  128. #define BACKGROUND_LIST 3       /* skeeter bug display list */
  129.  
  130. /*
  131.  * current trajectory info
  132.  */
  133. float leftXInc, leftYInc, leftZInc;
  134. float leftX, leftY, leftZ;
  135. float rightXInc, rightYInc, rightZInc;
  136. float rightX, rightY, rightZ;
  137. float flyAngle;
  138.  
  139. GLUquadricObj *cp1;            /* clay pidgeon #1 quadric object */
  140. GLUquadricObj *cp2;            /* clay pidgeon #2 quadric object */
  141.  
  142. /*
  143.  * struct for a falling cd
  144.  */
  145. typedef struct cdi {
  146.  
  147.       int    state;       /* state, none, falling, breaking */
  148.  
  149.       float     randx;        /* random number generated x      */
  150.       float    randy;        /* random number generated y      */
  151.  
  152.       float    XInc;        /* x position increment           */
  153.       float    YInc;        /* y position increment           */
  154.       float    ZInc;        /* z position increment           */
  155.  
  156.       float    posX;        /* current X position             */
  157.       float    posY;        /* current Y position             */
  158.       float    posZ;        /* current Z position             */
  159. } cd_i;
  160.  
  161. #define MAX_LIGHTS 3
  162. #define MAX_DROPS 10
  163. #define NONE 0
  164. #define FALLING 1
  165.  
  166.  
  167. cd_i  cd_info[MAX_DROPS];
  168.  
  169. int num_cd = 3;
  170. int num_lights = 1;
  171.  
  172. int DO_BACKGROUND = True;
  173.